<%-- 
  - Author: Mohtisham Salahria
  - Date: 10-April-2011
  - Copyright Notice: TRAKHEES
  - Description: form.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>

<c:if
	test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
	<script language="Javascript"
		src='<c:url value="/resources/js/ui/jquery.ui.datepicker-ar.js"/>'></script>
</c:if>
<script type="text/javascript">
	
$().ready(function() {
	
	//$( "input:submit, input:reset, input:button, input:file, .view").button();
	
	$("#fm-form").validate({
		onfocusout : false,
		onkeyup : false,
		//onclick: false,			
		rules : {
			strActionType : "required",
			strComments : "required"				
		},

		showErrors : function(errorMap, errorList) {

			var errors = '<ul>';
			var label;
			if (errorList.length) {
				$.each(errorMap, function(name, value) {
					label = $("label[for='" + name + "']").html();
					label = value + '[' + label + ']';
					errors = errors + '<li>' + label + '</li>';

				});
				errors = errors + '</ul>';
				jAlert('error', errors, '<spring:message code="label.errormessage" />');
			}
		}

	});
	$("input[name='close']").click(function(){
		window.location.href='${pageContext.request.contextPath}<%=ViewPath.USER_INTERNAL_TRAKHEES_STAFF_INBOX%>/<%=PageType.LIST.getPageType()%>.htm';		 
	});
});
	
	$(function() {			
		$( "#accordion" ).accordion();				
});
	
</script>

<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>'>
	<form:form name="fm-form" id="fm-form" method="POST"
		modelAttribute="<%=ConstantsAdmin.NON_CLIENT_PERSON_REGISTER_ADMIN_REVIEW_REQUEST_USER_DATA_MODEL_KEY %>">
		<spring:hasBindErrors
			name="<%=ConstantsAdmin.NON_CLIENT_PERSON_REGISTER_ADMIN_REVIEW_REQUEST_USER_DATA_MODEL_KEY %>">
			<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
		</spring:hasBindErrors>

		<div id=accordion>
			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message
						code="label.nonclient.person.register.personal.details" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<div class="fm-req">
					<form:label path="strNameTitle">
						<spring:message code="label.nonclient.person.register.title" />
					</form:label>

					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strNameTitleDescAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strNameTitleDescEn}" />
						</c:otherwise>
					</c:choose>
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="listRoleDisplay">
						<spring:message code="label.company.role" />
					</form:label>
					<div class="float">
						<c:forEach
							items="${nonClientPersonRegisterAdminReviewUserData.listRoleDisplay}"
							var="role">
							<div>
								<c:out value="${role}" />
							</div>
						</c:forEach>
					</div>
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strNonClientPersonNameENG">
						<spring:message code="label.nonclient.person.register.nameENG" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strNonClientPersonNameENG}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strNonClientPersonNameARB">
						<spring:message code="label.nonclient.person.register.nameARB" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strNonClientPersonNameARB}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strNonClientPersonNameARB">
						<spring:message code="label.client.category" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strCategoryDescAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strCategoryDescEn}" />
						</c:otherwise>
					</c:choose>


					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="iGender">
						<spring:message code="label.nonclient.person.register.gender" />
					</form:label>
					<c:if
						test="${nonClientPersonRegisterAdminReviewUserData.iGender == 0 }">
						<spring:message code="label.nonclient.person.register.male" />
					</c:if>
					<c:if
						test="${nonClientPersonRegisterAdminReviewUserData.iGender == 1 }">
						<spring:message code="label.nonclient.person.register.female" />
					</c:if>
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strDateOfBirth">
						<spring:message code="label.nonclient.person.register.dateOfBirth" />
					</form:label>
					<fmt:formatDate pattern="dd/MM/yyyy"
						value="${nonClientPersonRegisterAdminReviewUserData.strDateOfBirth}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strCity">
						<spring:message code="label.nonclient.person.register.city" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strCityNameAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strCityNameEn}" />
						</c:otherwise>
					</c:choose>
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strCountry">
						<spring:message code="label.nonclient.person.register.country" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strCountryNameAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strCountryNameEn}" />
						</c:otherwise>
					</c:choose>
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strNationality">
						<spring:message code="label.nonclient.person.register.nationality" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strNationality}" />
					<br />
				</div>
			</div>

			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message
						code="label.nonclient.person.register.contact.details" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<div class="fm-req">
					<form:label path="strAddressENG">
						<spring:message code="label.nonclient.person.register.addressENG" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strAddressENG}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strAddressARB">
						<spring:message code="label.nonclient.person.register.addressARB" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strAddressARB}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strPOBox">
						<spring:message code="label.nonclient.person.register.poBox" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strPOBox}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strPOBoxLocation">
						<spring:message
							code="label.nonclient.person.register.poBoxLocation" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strPOBoxLocation}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strTelNoHome">
						<spring:message code="label.nonclient.person.register.telNoHome" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strTelNoHome}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strTelNoOffice">
						<spring:message code="label.nonclient.person.register.telNoOffice" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strTelNoOffice}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div class="fm-req">
					<form:label path="strMobNo1">
						<spring:message code="label.nonclient.person.register.mobNo1" />
					</form:label>
					<div>
						<c:out
							value="${nonClientPersonRegisterAdminReviewUserData.strMobNo1}" />
					</div>
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strMobNo2">
						<spring:message code="label.nonclient.person.register.mobNo2" />
					</form:label>
					<div>
						<c:out
							value="${nonClientPersonRegisterAdminReviewUserData.strMobNo2}" />
					</div>
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strFaxNo">
						<spring:message code="label.nonclient.person.register.faxNo" />
					</form:label>
					<div>
						<c:out
							value="${nonClientPersonRegisterAdminReviewUserData.strFaxNo}" />
					</div>
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strWebsiteURL">
						<spring:message code="label.nonclient.person.register.websiteURL" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strWebsiteURL}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strEmailAddress">
						<spring:message
							code="label.nonclient.person.register.emailAddress" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strEmailAddress}" />
				</div>
				<div style="clear: both"></div>
			</div>


			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message
						code="label.nonclient.person.register.passport.details" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<div>
					<form:label path="strPassportNo">
						<spring:message code="label.nonclient.person.register.passportNo" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strPassportNo}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strPassportPlaceOfIssue">
						<spring:message
							code="label.nonclient.person.register.passportPlaceOfIssue" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strPassportPlaceOfIssue}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strPassportDateOfIssue">
						<spring:message
							code="label.nonclient.person.register.passprtDateOfIssue" />
					</form:label>
					<fmt:formatDate pattern="dd/MM/yyyy"
						value="${nonClientPersonRegisterAdminReviewUserData.strPassportDateOfIssue}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strPassportExpiryDate">
						<spring:message
							code="label.nonclient.person.register.passportExpiryDate" />
					</form:label>
					<fmt:formatDate pattern="dd/MM/yyyy"
						value="${nonClientPersonRegisterAdminReviewUserData.strPassportExpiryDate}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strEmiratesID">
						<spring:message code="label.nonclient.person.register.emiratesID" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strEmiratesID}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strEbdara">
						<spring:message code="label.nonclient.person.register.ebdara" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strEbdara}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strVisaNo">
						<spring:message code="label.nonclient.person.register.visaNo" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strVisaNo}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strVisaType">
						<spring:message code="label.nonclient.person.register.visaType" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strVisaTypeDescAr}" />
						</c:when>
						<c:otherwise>
							<c:out
								value="${nonClientPersonRegisterAdminReviewUserData.strVisaTypeDescEn}" />
						</c:otherwise>
					</c:choose>

					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strVisaExpiryDate">
						<spring:message
							code="label.nonclient.person.register.visaExpiryDate" />
					</form:label>
					<fmt:formatDate pattern="dd/MM/yyyy"
						value="${nonClientPersonRegisterAdminReviewUserData.strVisaExpiryDate}" />
					<br />
				</div>
				<div style="clear: both"></div>
				<div>
					<form:label path="strRemarks">
						<spring:message code="label.nonclient.person.register.remarks" />
					</form:label>
					<c:out
						value="${nonClientPersonRegisterAdminReviewUserData.strRemarks}" />
					<br />
				</div>
				<div style="clear: both"></div>
			</div>


			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message
						code="label.nonclient.person.register.documents.details" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<div class="t_fin-black-txt">
				<div class="fm-req">
					<table border="0">
						<c:forEach items="${adminActionHistory.uploadDocumentVOs}"
							var="docs" varStatus="loop">
							<tr>
								<c:choose>
									<c:when test="${docs.strUploadDocumentType == 'LEASE_COPY'}">
										<td><spring:message code="label.person.leasecopy" />
										</td>
										<td width="10px"></td>
										<td><a href="file/download.htm?fileId=${docs.lFileId}"
											class="view"><spring:message
													code="label.user.request.view" />
										</a>
										</td>
									</c:when>
									<c:otherwise>
										<td><spring:message code="label.person.contractcopy" />
										</td>
										<td width="10px"></td>
										<td><a href="file/download.htm?fileId=${docs.lFileId}"
											class="view"><spring:message
													code="label.user.request.view" />
										</a>
										</td>
										<br>
										<br>
									</c:otherwise>
								</c:choose>
							</tr>
						</c:forEach>
					</table>
				</div>
			</div>

			<div style="clear: both"></div>
			<fieldset>
				<legend>
					<spring:message code="label.actionhistory" />
				</legend>
			</fieldset>
			<div style="clear: both"></div>
			<br />
			<div class="t_fin-black-txt">
				<table style="width: 100%" class="t_grid-table">
					<tr class="ui-jqgrid-labels">
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.date" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.user" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.type" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.department" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.nonclient.person.register.action.comments" />
						</td>
						<td class="ui-state-default ui-th-column ui-th-ltr"><spring:message
								code="label.register.user.notification" />
						</td>
					</tr>
					<c:choose>
						<c:when test="${empty adminActionHistory.stepActionVOs}">
							<tr>
								<td colspan="6" align="center"><spring:message
										code="msg.no.actions.found" /></td>
							</tr>
						</c:when>
						<c:otherwise>
							<c:forEach items="${adminActionHistory.stepActionVOs}"
								var="actions" varStatus="loop">
								<tr>
									<td><fmt:formatDate pattern="dd/MM/yyyy"
											value="${actions.actionDate}" />
									</td>
									<td><c:out value="${actions.strActionUser}"></c:out>
									</td>
									<td><c:choose>
											<c:when test="${actions.strActionType == 'I' }">
												<spring:message code="msg.workflow.status.in.progress" />
											</c:when>
											<c:when test="${actions.strActionType == 'A' }">
												<spring:message code="msg.workflow.status.approved" />
											</c:when>
											<c:when test="${actions.strActionType == 'R' }">
												<spring:message code="msg.workflow.status.rejected" />
											</c:when>
										</c:choose></td>
									<c:forEach items="${adminActionHistory.commentsVOs}"
										var="comments" varStatus="commentloop">
										<c:if
											test="${actions.processStep.processStepCode == comments.processStep.processStepCode}">
											<c:if
												test="${registerAdminReview.strStepName ==  comments.processStep.processStepCode}">
												<c:set property="strApplnStatus"
													target="${adminActionHistory}" value="DEPT_ACTED"></c:set>
											</c:if>
											<c:choose>
												<c:when
													test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
													<td><c:out
															value="${comments.processStep.processStepDescAr}"></c:out>
													</td>
												</c:when>
												<c:otherwise>
													<td><c:out
															value="${comments.processStep.processStepDescEn}"></c:out>
													</td>
												</c:otherwise>
											</c:choose>
											<td><c:out value="${comments.strComments}"></c:out>
											</td>
											<td><c:out value="${comments.strCommentsUser}"></c:out>
											</td>
										</c:if>
									</c:forEach>
								</tr>
							</c:forEach>
						</c:otherwise>
					</c:choose>
				</table>
			</div>
			<div style="clear: both"></div>
		</div>
	</form:form>
	<c:choose>
		<c:when test="${adminActionHistory.strApplnStatus == 'DEPT_ACTED' }">
			<div style="clear: both">
				<br />
			</div>
			<div class="fm-req">
				<label><b><spring:message
							code="client.register.application.status" />
				</b>
				</label>
				<c:choose>
					<c:when
						test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
						<c:out value="${adminActionHistory.strStatusAr}" />
					</c:when>
					<c:otherwise>
						<c:out value="${adminActionHistory.strStatusEn}" />
					</c:otherwise>
				</c:choose>
			</div>
		</c:when>
		<c:when test="${adminActionHistory.strApplnStatus == 'I' }">
			<form:form name="fm-form" id="fm-form" method="POST"
				modelAttribute="<%=ConstantsAdmin.REGISTER_ADMIN_REVIEW_REQUEST_MODEL_KEY %>">
				<spring:hasBindErrors
					name="<%=ConstantsAdmin.REGISTER_ADMIN_REVIEW_REQUEST_MODEL_KEY %>">
					<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
				</spring:hasBindErrors>
				<%
					if (request.getAttribute(ConstantsAdmin.SUCCESS_PARAM) != null) {
				%>
				<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'success','<%=request
									.getAttribute(ConstantsAdmin.SUCCESS_PARAM)%>
					',
												'<spring:message code="msg.success" />');

										window.opener = 'x';
										window.close();
									});
				</script>
				<%
					}
				%>
				<div style="clear: both"></div>
				<fieldset>
					<legend>
						<spring:message code="label.admin.action" />
					</legend>
				</fieldset>
				<div style="clear: both"></div>
				<br />
				<div class="t_form-left t_fin-black-txt">
					<div class="fm-req">
						<form:label path="strActionDate">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.date" />
						</form:label>
						<form:input path="strActionDate" id="strActionDate" size="20"
							maxlength="100" readonly="true" />
					</div>
					<div class="fm-req">
						<form:label path="strUserName">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.user" />
						</form:label>
						<form:input path="strUserName" id="strUserName" size="20"
							maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strActionType">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.type" />
						</form:label>
						<c:choose>
							<c:when
								test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
								<form:select path="strActionType"
									items="${nonClientPersonRegisterActionTypeList}"
									id="strActionType" itemLabel="labelAr" itemValue="id"
									cssStyle="width:154px;" class="fm-opt" />
							</c:when>
							<c:otherwise>
								<form:select path="strActionType"
									items="${nonClientPersonRegisterActionTypeList}"
									id="strActionType" itemLabel="labelEn" itemValue="id"
									cssStyle="width:154px;" class="fm-opt" />
							</c:otherwise>
						</c:choose>
					</div>
					<div class="fm-req">
						<form:label path="strComments">
							<span class="t_star">*</span>
							<spring:message
								code="label.nonclient.person.register.action.comments" />
						</form:label>
						<form:textarea path="strComments" id="strComments" size="20"
							maxlength="100" style="width:190px;height:100px;" class="fm-opt" />
					</div>
					<div>
						<form:label path="strUserNotification">
							<spring:message code="label.register.user.notification" />
						</form:label>
						<form:textarea path="strUserNotification" id="strUserNotification"
							size="20" maxlength="100" style="width:190px;height:100px;"
							class="fm-opt" />
					</div>
					<div id="fm-submit" class="fm-req">
						<input type="submit" name="submit"
							value="<spring:message code="label.button.submit" />"
							class="t_btns submit" /> <input type="button" name="close"
							value="<spring:message code="label.button.close" />"
							class="t_btns submit" />
					</div>
				</div>

				<form:hidden path="strApplicationId" />
				<form:hidden path="strTaskId" />
				<form:hidden path="strIncidentNo" />
				<form:hidden path="strStepName" />
				<form:hidden path="department" />

			</form:form>
		</c:when>
		<c:otherwise>
			<div style="clear: both">
				<br />
			</div>
			<div class="fm-req">
				<label><b><spring:message
							code="client.register.application.status" />
				</b>
				</label>
				<c:choose>
					<c:when
						test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
						<c:out value="${adminActionHistory.strStatusAr}" />
					</c:when>
					<c:otherwise>
						<c:out value="${adminActionHistory.strStatusEn}" />
					</c:otherwise>
				</c:choose>
			</div>
		</c:otherwise>
	</c:choose>
</div>